<!doctype html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="{{ url_for('static', filename='front/css/style.css') }}" rel="stylesheet">
    <link rel="icon" href="{{ url_for('static', filename='common/favicon.ico') }}" type="image/x-icon"/>
    <script src="{{ url_for('static', filename='front/js/jquery-1.11.0.min.js') }}"></script>
    {% include 'common/_heads.html' %}
    <title>{% block title %}{% endblock %}CodingLife</title>
    <link type=text/css rel="stylesheet" href="{{ url_for('static', filename='front/css/index_base.css') }}">
    {% block head %}{% endblock %}

</head>
<body>
<div class="con">
    <div class="htmleaf-container">
        <nav class="navbar nb navbar-fixed-top">
            <div class="container-fluid">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                    {#                    <a class="navbar-brand" href="/">CodingLife</a>#}
                    <a class="navbar-brand" href="/" style="padding:6px 10px 10px 10px">
                        <img style="height: 39px;" alt="Brand" src="{{ url_for('static', filename="common/nav_logo.png") }}">
                    </a>
                    <button type="button" class="navbar-toggle navbar-toggle-border collapsed" data-toggle="collapse"
                            data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar icon-bar-border"></span>
                        <span class="icon-bar icon-bar-border"></span>
                        <span class="icon-bar icon-bar-border"></span>
                    </button>
                </div>

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav">
                        <li class="active"><a href="/">首页<span class="sr-only">(current)</span></a></li>
                    </ul>

                    <form class="form-inline navbar-form navbar-left">
                      <div class="form-group">
                        <div class="input-group">
                          <input type="text" class="form-control" id="kw" placeholder="请输入关键字">
                          <div class="input-group-addon"><span id="search" class="glyphicon glyphicon-search"></span></div>
                        </div>
                      </div>
                    </form>
                    <script type="text/javascript">
                            $(function () {
                                $('#search').click(function () {
                                    var kw = $("#kw").val();
                                    if (!kw) {
                                        return
                                    }
                                    window.location.href = "/search/?kw=" + kw;
                                });
                            });
                    </script>


                    <ul class="nav navbar-nav navbar-right">
                        {% if g.front_user %}
                            <li class="active"><a href="/thread">发贴</a></li>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                                   aria-haspopup="true" aria-expanded="false">{{ g.front_user.username }}<span
                                        class="caret"></span></a>
                                <ul class="dropdown-menu">
                                    <li><a href="{{ url_for('front.update_profile', id=g.front_user.id) }}">修改资料</a>
                                    </li>
                                    <li><a href="{{ url_for('front.threadlist', uid=g.front_user.id) }}">我的帖子</a>
                                    </li>
                                    <li><a href="{{ url_for('front.collectlist', uid=g.front_user.id) }}">我的收藏</a>
                                    </li>
                                    <li>
                                        <a href="{{ url_for('front.reset_password', email=g.front_user.email) }}">修改密码</a>
                                    </li>
                                    <li role="separator" class="divider"></li>
                                    <li><a href="{{ url_for('front.log_out') }}">退出登录</a></li>
                                </ul>
                            </li>
                        {% else %}
                            <li><a href="{{ url_for('front.register') }}">注册</a></li>
                            <li><a href="{{ url_for('front.login') }}">登录</a></li>
                        {% endif %}
                    </ul>
                </div><!-- /.navbar-collapse -->
            </div><!-- /.container-fluid -->
        </nav>
    </div>

    <div class="main-container">
        {% block body %}{% endblock %}
    </div>
    <footer>
        <nav class="navbar nb">
            <p>Powered by：高建&nbsp&nbsp&nbsp&nbspEmail：gjwlkj@gmail.com</p>
            <p>© 2019 CodingLife&nbsp&nbsp&nbsp&nbsp湘ICP备19007920号</p>
        </nav>
    </footer>

</div>
</body>
</html>
